package org.hxzon.rpggame.bean;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;

public class Mail {
    //
    private static final int Tag_System = 1 << 0;
    private static final int Tag_HadItems = 1 << 1;
    //
    private static final int Status_Readed = 1 << 2;
    private static final int Status_Fetched = 1 << 3;

    private boolean isSystemMail;
    private boolean isTrade;// 交易
    //
    private boolean isSendBack;
    private boolean isReaded;
    private boolean isDeleteS;
    private boolean isDeleteR;
    private boolean isFetched;
    //
    private String sysId;//系统公共邮件？为了节省存储
    private long id;
    private String title;
    private String content;
    private String sysmsg;// 系统信息

    private String senderId;
    private String receiverId;
    private String senderName;
    private String receiverName;

    private long sendTime;
    private long money;// 赠送银两，或交易所需银两
    private long tax;
    //
    private int itemListSize;
    private JSONArray itemsInfo;

    //
    private JSONObject callbackInfo;//系统回调参数

    //
    @Override
    public String toString() {
        return "ils:" + itemListSize + ",money:" + money;
    }

    public int getTag() {
        int tag = 0;
        tag |= (isSystemMail ? Tag_System : 0);
        tag |= (hasAttach() ? Tag_HadItems : 0);
        tag |= (isReaded ? Status_Readed : 0);
        tag |= (isFetched ? Status_Fetched : 0);
        return tag;
    }

    public boolean hasAttach() {
        return itemListSize > 0 || money > 0;
    }

    public JSONArray getItemsInfo() {
        return itemsInfo;
    }

    public void setItemsInfo(JSONArray itemsInfo) {
        this.itemsInfo = itemsInfo;
    }

    public int getItemListSize() {
        return itemListSize;
    }

    public void setItemListSize(int itemListSize) {
        this.itemListSize = itemListSize;
    }

    //
    public String getSysId() {
        return sysId;
    }

    public void setSysId(String sysId) {
        this.sysId = sysId;
    }

    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public boolean isSystemMail() {
        return isSystemMail;
    }

    public void setSystemMail(boolean isSystemMail) {
        this.isSystemMail = isSystemMail;
    }

    public boolean isSendBack() {
        return isSendBack;
    }

    public void setSendBack(boolean isSendBack) {
        this.isSendBack = isSendBack;
    }

    public boolean isTrade() {
        return isTrade;
    }

    public void setTrade(boolean isTrade) {
        this.isTrade = isTrade;
    }

    public boolean isReaded() {
        return isReaded;
    }

    public void setReaded(boolean isReaded) {
        this.isReaded = isReaded;
    }

    public boolean isDeleteS() {
        return isDeleteS;
    }

    public void setDeleteS(boolean isDeleteS) {
        this.isDeleteS = isDeleteS;
    }

    public boolean isDeleteR() {
        return isDeleteR;
    }

    public void setDeleteR(boolean isDeleteR) {
        this.isDeleteR = isDeleteR;
    }

    public boolean isFetched() {
        return isFetched;
    }

    public void setFetched(boolean isFetched) {
        this.isFetched = isFetched;
    }

    public String getSysmsg() {
        return sysmsg;
    }

    public void setSysmsg(String sysmsg) {
        this.sysmsg = sysmsg;
    }

    public long getSendTime() {
        return sendTime;
    }

    public void setSendTime(long sendTime) {
        this.sendTime = sendTime;
    }

    public String getSenderId() {
        return senderId;
    }

    public void setSenderId(String senderId) {
        this.senderId = senderId;
    }

    public String getReceiverId() {
        return receiverId;
    }

    public void setReceiverId(String receiverId) {
        this.receiverId = receiverId;
    }

    public String getSenderName() {
        return senderName;
    }

    public void setSenderName(String senderName) {
        this.senderName = senderName;
    }

    public String getReceiverName() {
        return receiverName;
    }

    public void setReceiverName(String receiverName) {
        this.receiverName = receiverName;
    }

    public long getMoney() {
        return money;
    }

    public void setMoney(long money) {
        this.money = money;
    }

    public long getTax() {
        return tax;
    }

    public void setTax(long tax) {
        this.tax = tax;
    }

    public JSONObject getCallbackInfo() {
        return callbackInfo;
    }

    public void setCallbackInfo(JSONObject callbackInfo) {
        this.callbackInfo = callbackInfo;
    }

}
